package com.kemai.adapter

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.kemai.view.R

/**

 *@description:TODO
 * @author: zhaoshanshan
 * @date: 2022/12/6 4:44 下午

 */
class NestedScrollViewRvAdapter: RecyclerView.Adapter<NestedScrollViewRvAdapter.ViewHolder>{
     private var data:ArrayList<String>? = null
     constructor(data:ArrayList<String>){
         this.data = data
     }

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {

        val view = LayoutInflater.from(parent.context).inflate(R.layout.nestedscrollvewrvadapter_item,parent,false)
        return ViewHolder(view)

    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        holder.tv.text = data?.get(position)


    }

    override fun getItemCount(): Int {
        return data!!.size
    }

    inner class ViewHolder:RecyclerView.ViewHolder{
        val tv:TextView = itemView.findViewById(R.id.tv)
        constructor(itemView: View):super(itemView)


    }
}